<?php
/**
 * 系统设置权限
 * User: cxm
 * Date: 2018/12/17
 * Time: 11:26
 */
namespace Seeds\Admin;

use App\Models\AdminPermission;

class SystemSeeder
{
    /**
     * Run the database seeds.
     *
     * @return void
     */
    public static function run()
    {
        // 一级
        $system = AdminPermission::create([
            'pid' => 0, 'sort' =>900, 'http_method' => ['GET'], 'name' => '系统管理', 'fid' => null, 'icon' => 'el-icon-s-tools',
            'http_path' => 'javascript', 'menu_switch' => 2,'slug'=>'system'
        ]);

        /** ++++++++++++++++++++++++++++++++++++++++++++++++++菜单管理start++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++*/
        $menu = AdminPermission::create([
            'pid' => $system->id, 'sort' =>100, 'http_method' => ['GET'], 'name' => '菜单管理', 'fid' => null, 'icon' => 'layui-icon-app',
            'url'=>'menu_list','http_path' => 'javascript:;', 'menu_switch' => 1
        ]);

        //获取列表数据
        AdminPermission::create([
            'pid' => $menu->id, 'sort' =>20, 'http_method' => ['POST'], 'name' => '列表', 'fid' => $menu->id, 'icon' => '',
            'http_path' => '/admin/menu/get-lists', 'menu_switch' => 1
        ]);
        // 添加
        $add_menu = AdminPermission::create([
            'pid' => $menu->id, 'sort' =>20, 'http_method' => ['GET'], 'name' => '添加', 'fid' => null, 'icon' => '',
            'url'=>'menu_add','http_path' => 'javascript:;', 'menu_switch' => 1
        ]);

        //添加处理
        AdminPermission::create([
            'pid' => $menu->id, 'sort' =>20, 'http_method' => ['POST'], 'name' => '保存', 'fid' => $add_menu->id, 'icon' => '',
            'http_path' => '/admin/menu/store', 'menu_switch' => 1
        ]);

        // 编辑
        $edit_menu = AdminPermission::create([
            'pid' => $menu->id, 'sort' =>20, 'http_method' => ['GET'], 'name' => '编辑', 'fid' => null, 'icon' => '',
            'url'=>'menu_edit','http_path' => 'javascript:;', 'menu_switch' => 1
        ]);

        //添加处理
        AdminPermission::create([
            'pid' => $menu->id, 'sort' =>20, 'http_method' => ['POST'], 'name' => '保存', 'fid' => $edit_menu->id, 'icon' => '',
            'http_path' => '/admin/menu/store', 'menu_switch' => 1
        ]);

        // 删除
        AdminPermission::create([
            'pid' => $menu->id, 'sort' =>20, 'http_method' => ['POST'], 'name' => '删除', 'fid' => null, 'icon' => '',
            'http_path' => '/admin/menu/delete', 'menu_switch' => 1
        ]);
        /** ++++++++++++++++++++++++++++++++++++++++++++++++++菜单管理end++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++*/

        /** ++++++++++++++++++++++++++++++++++++++++++++++++++城市管理start++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++*/
        $menu = AdminPermission::create([
            'pid' => $system->id, 'sort' =>110, 'http_method' => ['GET'], 'name' => '城市管理', 'fid' => null, 'icon' => 'md-outlet',
            'url'=>'city_list','http_path' => 'javascript:;', 'menu_switch' => 1
        ]);

        //获取列表数据
        AdminPermission::create([
            'pid' => $menu->id, 'sort' =>20, 'http_method' => ['POST'], 'name' => '列表', 'fid' => $menu->id, 'icon' => '',
            'http_path' => '/admin/city/get-lists', 'menu_switch' => 1
        ]);

        //添加处理
        AdminPermission::create([
            'pid' => $menu->id, 'sort' =>20, 'http_method' => ['POST'], 'name' => '保存', 'fid' => null, 'icon' => '',
            'http_path' => '/admin/city/store', 'menu_switch' => 1
        ]);

        // 删除
        AdminPermission::create([
            'pid' => $menu->id, 'sort' =>20, 'http_method' => ['POST'], 'name' => '删除', 'fid' => null, 'icon' => '',
            'http_path' => '/admin/city/delete', 'menu_switch' => 1
        ]);

        // 保存到文件
        AdminPermission::create([
            'pid' => $menu->id, 'sort' =>20, 'http_method' => ['POST'], 'name' => '保存到文件', 'fid' => null, 'icon' => '',
            'http_path' => '/admin/city/export', 'menu_switch' => 1
        ]);

        // 所有数据
        AdminPermission::create([
            'pid' => $menu->id, 'sort' =>20, 'http_method' => ['POST'], 'name' => '所有数据', 'fid' => null, 'icon' => '',
            'http_path' => '/admin/city/allData', 'menu_switch' => 1
        ]);
        // 排序
        AdminPermission::create([
            'pid' => $menu->id, 'sort' =>20, 'http_method' => ['POST'], 'name' => '排序', 'fid' => null, 'icon' => '',
            'http_path' => '/admin/city/updateSort', 'menu_switch' => 1
        ]);
        /** ++++++++++++++++++++++++++++++++++++++++++++++++++城市管理end++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++*/


        /** ++++++++++++++++++++++++++++++++++++++++++++++++++系统设置start++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++*/
        $config = AdminPermission::create([
            'pid' => $system->id, 'sort' =>120, 'http_method' => ['GET'], 'name' => '系统设置', 'fid' => null, 'icon' => 'layui-icon-app',
            'url'=>'system_lists','http_path' => 'javascript:;', 'menu_switch' => 2
        ]);

        //获取列表数据
        AdminPermission::create([
            'pid' => $config->id, 'sort' =>20, 'http_method' => ['POST'], 'name' => '系统参数', 'fid' => $config->id, 'icon' => '',
            'http_path' => '/admin/system/config', 'menu_switch' => 1
        ]);

        //添加处理
        AdminPermission::create([
            'pid' => $config->id, 'sort' =>20, 'http_method' => ['POST'], 'name' => '添加处理', 'fid' => '', 'icon' => '',
            'http_path' => '/admin/system/config/store', 'menu_switch' => 1
        ]);

        //编辑处理
        AdminPermission::create([
            'pid' => $config->id, 'sort' =>20, 'http_method' => ['POST'], 'name' => '编辑处理', 'fid' => '', 'icon' => '',
            'http_path' => '/admin/system/config/store', 'menu_switch' => 1
        ]);

        // 产品删除
        AdminPermission::create([
            'pid' => $config->id, 'sort' =>20, 'http_method' => ['POST'], 'name' => '删除', 'fid' => null, 'icon' => '',
            'http_path' => '/admin/system/config/delete', 'menu_switch' => 1
        ]);

        // 清除redis
        AdminPermission::create([
            'pid' => $config->id, 'sort' =>20, 'http_method' => ['POST'], 'name' => '清除redis', 'fid' => null, 'icon' => '',
            'http_path' => '/admin/system/config/flush', 'menu_switch' => 1
        ]);

        /** ++++++++++++++++++++++++++++++++++++++++++++++++++系统设置end++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++*/

        /** ++++++++++++++++++++++++++++++++++++++++++++++++++ 投诉建议start++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++*/
        $feedback = AdminPermission::create([
            'pid' => $system->id, 'sort' =>300, 'http_method' => ['GET'], 'name' => '投诉建议', 'fid' => null, 'icon' => 'ios-chatboxes',
            'url'=>'advise_list','http_path' => 'javascript:;', 'menu_switch' =>2
        ]);

        // 列表
        AdminPermission::create([
            'pid' => $feedback->id, 'sort' =>10, 'http_method' => ['POST'], 'name' => '获取列表', 'fid' => null, 'icon' => '',
            'http_path' => '/admin/advise/getLists', 'menu_switch' =>1
        ]);

        // 删除
        AdminPermission::create([
            'pid' => $feedback->id, 'sort' =>50, 'http_method' => ['POST'], 'name' => '删除', 'fid' => null, 'icon' => '',
            'http_path' => '/admin/advise/delete', 'menu_switch' =>1
        ]);

        // 投诉处理
        AdminPermission::create([
            'pid' => $feedback->id, 'sort' =>50, 'http_method' => ['POST'], 'name' => '投诉处理', 'fid' => null, 'icon' => '',
            'http_path' => '/admin/advise/dispose', 'menu_switch' =>1
        ]);
        /** ++++++++++++++++++++++++++++++++++++++++++++++++++投诉建议end++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++*/

    }
}